﻿@using System.Data
@using ZoomLa.BLL
@using ZoomLa.SQLDAL
@using ZoomLa.Common
@using ZoomLa.Model
@model ZoomLa.SQLDAL.SQL.PageSetting
@{ 
    Model.cols = 10;
    B_Exam_Sys_Questions questBll = new B_Exam_Sys_Questions();
}
@functions{
    B_Exam_Class classBll = new B_Exam_Class();
    B_Questions_Knowledge knowBll = new B_Questions_Knowledge();
    public string GetClass(int classid)
    {
        M_Exam_Class mec = classBll.GetSelect(classid);
        if (mec != null && mec.C_id > 0)
        {
            return mec.C_ClassName;
        }
        else
        {
            return "";
        }

    }
    public string GetTagKeys(string tagkey)
    {
        DataTable KnowsNames = knowBll.Sel();
        if (KnowsNames.Rows.Count > 0 && !string.IsNullOrEmpty(tagkey))
        {
            string knownames = "";
            DataRow[] drs = KnowsNames.Select("k_id IN (" + tagkey.Trim(',') + ")");
            foreach (DataRow item in drs)
            {
                knownames += item["k_name"].ToString() + ",";
            }
            string names = knownames.Trim(',');
            names = names.Length > 10 ? names.Substring(0, 10) + "..." : names;
            return names.Length > 10 ? names.Substring(0, 10) + "..." : names;
        }
        return "";
    }
}
<div id="EGV">
    <table class="table table-striped table-bordered table-hover margin_t5">
        @if (Model.itemCount > 0)
        {
            <tr><th></th><th>ID</th><th>试题标题</th><th>作者</th><th>难度</th><th>类别</th><th>题型</th><th>知识点</th><th>创建时间</th><th>相关操作</th></tr>
            foreach (DataRow dr in Model.dt.Rows)
            {
                <tr>
                    <td><input type="checkbox" name="idchk" value="@dr["p_id"]" /></td>
                    <td>@dr["p_id"]</td>
                    <td><a href="AddEngLishQuestion?id=@dr["p_id"]">@dr["p_title"]</a></td>
                    <td>@dr["p_Inputer"]</td>
                    <td>@questBll.GetDiffStr(DataConverter.CDouble(dr["p_Difficulty"]))</td>
                    <td>@GetClass(DataConverter.CLng(dr["p_Class"]))</td>
                    <td>@M_Exam_Sys_Questions.GetTypeStr(DataConverter.CLng(dr["p_Type"]))</td>
                    <td>@GetTagKeys(dr["Tagkey"].ToString())</td>
                    <td>@DataConverter.CDate(dr["p_CreateTime"]).ToString("yyyy/MM/dd HH:mm")</td>
                    <td>
                        <a href="QuestShow?id=@dr["p_id"]" title="预览" class="option_style"><span class="fa fa-eye" title="预览"></span></a>
                        <a href="AddEngLishQuestion?id=@dr["p_id"]" title="修改" class="option_style"><span class="fa fa-pencil" title="修改"></span></a>
                        <a href="javascript:;" onclick="mvcpage.del({ ids: @dr["p_id"], url: 'Question_Del', confirm: '确定要删除吗？' });" class="option_style"><span class="fa fa-trash" title="删除"></span>删除</a>
                    </td>
                </tr>
            }
        }
        else
        {
            <tr><td colspan="10">当前没有试题信息</td></tr>
        }
        @Html.Partial("_page", Model)
    </table>
</div>